import { defineStore } from 'pinia';

import router from '../router';

export interface PageDataState {
  /**
   * 共享数据
   */
  sharedDataMap: Recordable<Recordable>;
  /**
   * 共享可刷新数据
   */
  // sharedRefreshableDataMap: Recordable<Recordable<RefreshableData>>;
  sharedRefreshableDataMap: Recordable<Recordable<any>>;
  /**
   * 共享可刷新数据引用计数
   */
  sharedRefreshableDataRefCountMap: Recordable<Recordable<number>>;
}

export const usePageDataStore = defineStore({
  id: 'app-page-data',
  getters: {
    /**
     * 当前路由fullPath
     */
    currentPageFullPath() {
      return router.currentRoute.value.fullPath;
    },
  },
});
